(function (G) {
    G.vue({
        data: {
            LIST_count:3,
            selectIndex: 0,
            userId:'',
            APIURL:G.Storage.get('APIURL'),
            status: ['待处理', '已处理'],
            types:{
                '1':'日常检查考核',
                '2':'月度集中考核',
                '3':'公众监督考核',
                '4':'重大事项考核'
            }
        },
        methods: {
            showFile(e){
                G.showFile(e.currentTarget.dataset.img,true)
            },
            changeActive(e){
                let selectIndex = e.currentTarget.dataset.index
                this.setData({LIST_index:selectIndex})
            },
            onReachBottom() {
                this.LIST_load(this.getData('LIST_index'))
            },
            formatImgUrl(url){
                return url.indexOf('http') == 0 ? url : (G.Storage.get('APIURL') + url)
            }
        },
        mounted(query) {
            let userId = query.userId || G.Storage.get('userInfo').userId,_this = this
            this.setData({ userId })
            wx.setNavigationBarTitle({
              title: '考核记录',
            })
            let types = this.data.types
            function buildList(type){
                return G.list({
                    dataFormat(row){
                      //row.images = row.images.split(',')
                      row.imgUrlList = G.string(row.imgUrlList).parse([])
                      for(let i = 0; i < row.imgUrlList.length; i ++){
                          row.imgUrlList[i] = _this.formatImgUrl(row.imgUrlList[i])
                      }
                      row.rectificationImg = G.string(row.rectificationImg).parse([])
                      for(let i = 0; i < row.rectificationImg.length; i ++){
                        row.rectificationImg[i] = _this.formatImgUrl(row.rectificationImg[i])
                    }
                      row.createTime = row.time || G.date(row.createTime).Format('yyyy-MM-dd HH:mm:ss')
                      row.typeText = types[row.type]
                    },
                    get:{url:'/api/model/assess',data:{userId,rectificationImg:type == 1 ? 'ISNULL' : 'ISNOTNULL'}}
                })
            }
            this.LIST_init([
                buildList(1),
                buildList(2)
            ])
            this.LIST_loads()
        }
    })
})(wx.$)